#include<bits/stdc++.h>
#define sd(n) scanf("%d",&n) 
#define pd(n) printf("%d", (n))
const int N = 40;
typedef long long int ll;
using namespace std;
//----------------------------------------------------------------------------//
int n,mx;
int x_, y_, r_, s_;
bool st[N][N];
class tree
{
public:
	tree(int& x, int& y, int& r, int& s)
		:_x(x), _y(y), _r(r), _s(s)
	{}

	tree(const tree& t2)
	{
		_x = t2._x;
		_y = t2._y;
		_r = t2._r;
		_s = t2._s;
	}
	bool check(tree& t2)
	{
		if (pow(_x - t2._x, 2) + pow(_y - t2._y, 2) >= pow(_r + t2._r, 2)) return false;
		else return true;
	}


//private:
	int _x, _y, _r, _s;
};
vector<tree> v;
vector<int> pt;

void dfs(int u, int s_now)
{
	if (u == n)
	{
		if (s_now > mx) mx = s_now;
		return;
	}
	for (auto k : pt)
	{
		if (v[u].check(v[k]))
		{
			dfs(u + 1, s_now);
			return;
		}
	}
	pt.push_back(u);
	dfs(u + 1, s_now + v[u]._s);
	pt.pop_back();//恢复状态
	dfs(u + 1, s_now);
	return;
}
int main()
{
	sd(n);
	for (int i = 0; i < n; i++)
	{
		sd(x_); sd(y_); sd(r_);
		s_ = pow(r_, 2);
		tree tmp(x_, y_, r_, s_);
		v.push_back(tmp);
	}
	for (int i = 1; i <= n; i++)
	{
		st[i][i] = true;
		for (int j = 0; j < i; j++)
		{
			st[i][j] = v[i].check(v[j]);
			st[j][i] = st[i][j];
		}
	}
	dfs(0, 0);
	pd(mx);
	return 0;
}